package servlet.servlet_yaobo;

import pojo.Order;
import service.impl.ImpShoppingMemberService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Timestamp;

/**
 * 用于修改订单详情
 */
@WebServlet(value = "/dingDan")
public class OrderServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Order or=new Order();
       String id=req.getParameter("ID");
        String price=req.getParameter("PRICE");
        String state=req.getParameter("STATE");
       String address=req.getParameter("ADDRESS");
       String remarks=req.getParameter("REMARKS");
       String date=req.getParameter("DATE");
       or.setOrderId(Integer.parseInt(id));
       or.setOrderPrice((int)Double.parseDouble(price));
       or.setOrderState(Integer.parseInt(state));
       or.setOrderAddress(address);
      or.setOrderRemarks(remarks);
      or.setOrderDate(Timestamp.valueOf(date));
        ImpShoppingMemberService imp=new ImpShoppingMemberService();
        imp.dingDan(or);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
